package com.yin.project.admin.rbac.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yin.project.admin.rbac.model.MenuEntity;
import com.yin.project.admin.rbac.repository.MenuRepository;
import com.yin.project.admin.rbac.service.MenuService;

/**
 * Created by Eason on 2016/12/1.
 */
@Service(value = "menuService")
public class MenuServiceImpl implements MenuService{

    @Autowired
    MenuRepository menuRepository;

    public List<MenuEntity> queryMenusByParams() {
        return menuRepository.findAll();
    }

    public void addMenu(MenuEntity menu) {
    	menuRepository.save(menu);
	}

	public MenuEntity updateMenu(MenuEntity menuEntity) {
		 return menuRepository.save(menuEntity);
	}
	public MenuEntity queryMenusById(String id) {
		return menuRepository.findOne(id);
	}

	public void deleteMenu(String id) {
		menuRepository.delete(id);
	}
}